<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
    <div id="login">

    </div>

    <form action="/user/login" method="post">
        <table>
            <tr>
                <td>
                    <input type="text" name="email" id="email" placeholder="邮箱"/>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="password" name="password" id="password" placeholder="密码"/>
                </td>
            </tr>
        </table>
        <!--        <input type="submit" value="登录">-->
        <button type="button" onclick="login()">登录</button>
    </form>

    <script>
        // new Vue({
        //     el: '#login',
        //     data () {
        //         return {
        //             info: null
        //         }
        //     },
        //     mounted () {
        //         axios
        //             .post('/user/login',{email,password})
        //             .then(response => (this.info = response.data))
        //     }
        // })
        function login() {
            $.post("/user/login", {"email":email.value,"password":password.value}, function (data) {
                if (data) {
                    // window.location.href = "/itemtest.html";
                    window.location.href = "/index.html";
                }
                else {
                    alert("失败");
                }
            });
        }
    </script>
</body>
</html>